<?php 
       $color = array( 
        '#00FF00', 
        '#FF0000',
	    '#0000FF',
	    '#E8EEF7', 
    ); 
     
    $dataMultiple = array(array(20,20,20,40)); 
     
    $googleChart->setChartAttrs(  
        array( 
            'type'         => 'pie', 
            'title'     => '', 
            'data'         => $dataMultiple, 
            'size'         => array( 400, 200 ), 
            'color'     => $color, 
            'labelsXY'     => true, 
            'min'        => array(), 
            'max'        => array(), 
            'legend'    => array('Potong', 'Bidding', 'Cash', 'HP') 
        ) 
    ); 
     $chco='';
     $chl='';
    foreach($repSalesByType as $k=>$v) {
    	$chco .= $k;
    	$chco .= "|";
    	$chl .= $v;
    	$chl .= "|";
    }
//    $url =  ("http://chart.apis.google.com/chart?chs=340x225&cht=p3&chco=00FF00|FF0000|0000FF|E8EEF7&chd=s:Uf9a&chdl=$chco&chl=$chl&chma=10,10,10,10&chtt=Total+Sales+by+Type+for+January+2011&chts=676767,13.6");
//    echo $this->Html->image($url); 
    // Print chart 
//    echo $googleChart; 

//    http://chart.apis.google.com/chart
//   ?chs=340x225
//   &cht=p3
//   &chco=00FF00|FF0000|0000FF|E8EEF7
//   &chd=s:Uf9a
//   &chdl=HP|Potong|Bidding|Cash
//   &chl=32.787%|50.82%|100%|42.623%
//   &chma=10,10,10,10
//   &chtt=Total+Sales+by+Type+for+January+2011
//   &chts=676767,13.6
    ?> 
    
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Task');
        data.addColumn('number', 'Hours per Day');
        data.addRows(<?php echo count($repSalesByType);?>);
        <?php 
        $i = 0;
        foreach ($repSalesByType as $k=>$v) : 
        ?>
        data.setValue(<?php echo $i?>, 0,'<?php echo $k ?>');
        data.setValue(<?php echo $i?>, 1, <?php echo $v ?>);
        <?php 
        $i++;
        endforeach;?>

        var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
        chart.draw(data, {width: 450, height: 300, title: 'Types of sales for this month'});
      }
    </script>
    
    <div id="chart_div"></div>
    